package com.pearadmin.pro.modules.training.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pearadmin.pro.common.web.base.page.PageResponse;
import com.pearadmin.pro.common.web.base.page.Pageable;
import com.pearadmin.pro.modules.training.entity.TrainingConsumable;
import com.pearadmin.pro.modules.training.entity.vo.PageTrainingConsumableVO;
import com.pearadmin.pro.modules.training.mapper.TrainingConsumableRepository;
import com.pearadmin.pro.modules.training.service.TrainingConsumableService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TrainingConsumableServiceImpl extends ServiceImpl<TrainingConsumableRepository, TrainingConsumable> implements TrainingConsumableService {


    @Resource
    private TrainingConsumableRepository trainingConsumableRepository;

    @Override
    public PageResponse<TrainingConsumable> page(PageTrainingConsumableVO request) {
        return Pageable.of(request,(()-> trainingConsumableRepository.page(request)));
    }

    @Override
    public boolean insertInto(TrainingConsumable trainingConsumable) {
        int insert = trainingConsumableRepository.insertInto(trainingConsumable);
        return insert>0;

    }
}
